<?php

namespace App\Providers;

use App\Events\Plane\PlaneOrder\Flight\PlaneOrderFlightChangedEvent;
use App\Events\Plane\PlaneOrder\PlaneOrderChangeNeedPayEvent;
use App\Events\Plane\PlaneOrder\PlaneOrderCreatedEvent;
use App\Events\Plane\PlaneOrder\PlaneOrderPaidEvent;
use App\Events\Plane\PlaneOrder\PlaneOrderTicketedEvent;
use App\Events\Plane\PlaneOrder\PlaneOrderTicketFailedEvent;
use App\Events\Plane\PlaneOrder\Refund\PlaneOrderTicketReturnFailedEvent;
use App\Events\Plane\PlaneOrder\Refund\PlaneOrderTicketReturnSuccessEvent;
use App\Events\Plane\PlaneTicketQueryEvent;
use App\Events\Train\TicketQueryEvent;
use App\Events\Train\TrainOrder\Refund\TicketReturnApplyEvent;
use App\Events\Train\TrainOrder\Refund\TicketReturnFailedEvent;
use App\Events\Train\TrainOrder\Refund\TicketReturnSuccessEvent;
use App\Events\Train\TrainOrder\TrainOrderCreatedEvent;
use App\Events\Train\TrainOrder\TrainOrderPaidEvent;
use App\Events\Train\TrainOrder\TrainOrderTicketedEvent;
use App\Events\Train\TrainOrder\TrainOrderTicketFailedEvent;
use App\Listeners\Plane\PlaneOrder\Flight\PlaneOrderFlightChangedListener;
use App\Listeners\Plane\PlaneOrder\PlaneOrderChangeNeedPayListener;
use App\Listeners\Plane\PlaneOrder\PlaneOrderCreatedListener;
use App\Listeners\Plane\PlaneOrder\PlaneOrderPaidListener;
use App\Listeners\Plane\PlaneOrder\PlaneOrderTicketedListener;
use App\Listeners\Plane\PlaneOrder\PlaneOrderTicketFailedListener;
use App\Listeners\Plane\PlaneOrder\Refund\PlaneOrderTicketReturnFailedListener;
use App\Listeners\Plane\PlaneOrder\Refund\PlaneOrderTicketReturnSuccessListener;
use App\Listeners\Plane\PlaneTicketQueryListener;
use App\Listeners\Plane\PlaneTicketQueryLogListener;
use App\Listeners\Train\Snap\TrainSnapPaidListener;
use App\Listeners\Train\TicketQueryListener;
use App\Listeners\Train\TicketQueryLogListener;
use App\Listeners\Train\TrainOrder\PassengerApplyRefundListener;
use App\Listeners\Train\TrainOrder\Refund\TicketReturnApplyListener;
use App\Listeners\Train\TrainOrder\Refund\TicketReturnFailedListener;
use App\Listeners\Train\TrainOrder\Refund\TicketReturnSuccessListener;
use App\Listeners\Train\TrainOrder\TrainOrderCreatedListener;
use App\Listeners\Train\TrainOrder\TrainOrderPaidListener;
use App\Listeners\Train\TrainOrder\TrainOrderTicketedListener;
use App\Listeners\Train\TrainOrder\TrainOrderTicketFailedListener;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;

class EventServiceProvider extends ServiceProvider
{
    /**
     * The event listener mappings for the application.
     *
     * @var array<class-string, array<int, class-string>>
     */
    protected $listen
        = [
            Registered::class       => [
                SendEmailVerificationNotification::class,
            ],
            TicketQueryEvent::class => [
                TicketQueryListener::class,
                TicketQueryLogListener::class,
            ],

            PlaneTicketQueryEvent::class              => [
                PlaneTicketQueryListener::class,
                PlaneTicketQueryLogListener::class,
            ],

            // 订单创建事件 1 自动取消 2 取消前 通知 3 取消通知 ....
            TrainOrderCreatedEvent::class             => [
                TrainOrderCreatedListener::class,
            ],

            // 火车票订单已支付事件 含 1 下单 改签 | 2 抢票
            TrainOrderPaidEvent::class                => [
                TrainOrderPaidListener::class,
                TrainSnapPaidListener::class,
            ],

            // 火车票订单已出票事件
            TrainOrderTicketedEvent::class            => [
                TrainOrderTicketedListener::class,
            ],

            // 火车票订单申请退票退款事件
            TicketReturnApplyEvent::class             => [
                TicketReturnApplyListener::class,
                PassengerApplyRefundListener::class,
            ],

            // 火车票订单出票失败事件
            TrainOrderTicketFailedEvent::class        => [
                TrainOrderTicketFailedListener::class,
            ],


            // 火车票订单退票成功事件 -》更新退款状态 -》 发起退款
            TicketReturnSuccessEvent::class           => [
                TicketReturnSuccessListener::class,
            ],

            // 火车票订单退票失败事件 -》更新订单状态 及退款单状态
            TicketReturnFailedEvent::class            => [
                TicketReturnFailedListener::class,
            ],

            // 飞机票订单创建事件 1 自动取消 2 取消前 通知 3 取消通知 ....
            PlaneOrderCreatedEvent::class             => [
                PlaneOrderCreatedListener::class,
            ],

            //飞机票订单已支付事件 含 1 下单 改签
            PlaneOrderPaidEvent::class                => [
                PlaneOrderPaidListener::class,
            ],

            // 飞机票 订单已出票事件
            PlaneOrderTicketedEvent::class            => [
                PlaneOrderTicketedListener::class,
            ],

            // 飞机票 变更通知  事件
            PlaneOrderFlightChangedEvent::class       => [
                PlaneOrderFlightChangedListener::class,
            ],

            // 飞机票 出票失败
            PlaneOrderTicketFailedEvent::class        => [
                PlaneOrderTicketFailedListener::class,
            ],

            // 飞机票退票成功
            PlaneOrderTicketReturnSuccessEvent::class => [
                PlaneOrderTicketReturnSuccessListener::class,
            ],
            // 飞机票退票失败
            PlaneOrderTicketReturnFailedEvent::class  => [
                PlaneOrderTicketReturnFailedListener::class,
            ],


            // 飞机票改签-服务商需支付
            PlaneOrderChangeNeedPayEvent::class       => [
                PlaneOrderChangeNeedPayListener::class,
            ],

        ];

    /**
     * Register any events for your application.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Determine if events and listeners should be automatically discovered.
     *
     * @return bool
     */
    public function shouldDiscoverEvents()
    {
        return false;
    }
}
